import { defHttp } from '@/utils/http/axios';
import { AddCountry, Country, EditCountry } from './type';
import { BasicFetchResult } from '@/api/model/baseModel';



enum Api {
    getCountryList = '/admin/org/countrys/pageList',
    addCountry = '/admin/org/countrys/add',
    editCountry = '/admin/org/countrys/update',
    delCountry = '/admin/org/countrys/del'
}

/**
 * @description 查询国家列表
 * @date
 * @export
 * @param
 */
export function getCountryList(params: any) {
    return defHttp.get<BasicFetchResult<Country>>({
        url: Api.getCountryList,
        params
    });
}

/**
 * 新增国家
 * @param data 
 * @returns 
 */
export function addCountry(data: AddCountry) {
    return defHttp.post({
        url: Api.addCountry,
        data
    });
}

/**
 * 修改国家
 * @param data 
 * @returns 
 */
export function editCountry(data: EditCountry) {
    return defHttp.post({
        url: Api.editCountry,
        data
    });
}

/**
 * 删除国家
 * @param id 
 * @returns 
 */
export function delCountry(id: number) {
    return defHttp.post({
        url: Api.delCountry + '?id=' + id,
    });
}
